package com.ruoyi.system.service.impl;

import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.JiajiaWorkerInterest;
import com.ruoyi.system.mapper.JiajiaWorkerInterestMapper;
import com.ruoyi.system.service.IJiajiaWorkerInterestService;
import com.ruoyi.system.utils.TokenUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 社工关注Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-04-15
 */
@Service
public class JiajiaWorkerInterestServiceImpl implements IJiajiaWorkerInterestService 
{
    @Autowired
    private JiajiaWorkerInterestMapper jiajiaWorkerInterestMapper;

    /**
     * 查询社工关注
     * 
     * @param id 社工关注主键
     * @return 社工关注
     */
    @Override
    public JiajiaWorkerInterest selectJiajiaWorkerInterestById(Long id)
    {
        return jiajiaWorkerInterestMapper.selectJiajiaWorkerInterestById(id);
    }

    /**
     * 查询社工关注列表
     * 
     * @param jiajiaWorkerInterest 社工关注
     * @return 社工关注
     */
    @Override
    public List<JiajiaWorkerInterest> selectJiajiaWorkerInterestList(JiajiaWorkerInterest jiajiaWorkerInterest)
    {

        return jiajiaWorkerInterestMapper.selectJiajiaWorkerInterestList(jiajiaWorkerInterest);
    }

    /**
     * 新增社工关注
     * 
     * @param jiajiaWorkerInterest 社工关注
     * @return 结果
     */
    @Override
    public int insertJiajiaWorkerInterest(JiajiaWorkerInterest jiajiaWorkerInterest)
    {
        jiajiaWorkerInterest.setUserId(TokenUtil.getUid());
        jiajiaWorkerInterest.setCreateTime(DateUtils.getNowDate());
        return jiajiaWorkerInterestMapper.insertJiajiaWorkerInterest(jiajiaWorkerInterest);
    }

    /**
     * 修改社工关注
     * 
     * @param jiajiaWorkerInterest 社工关注
     * @return 结果
     */
    @Override
    public int updateJiajiaWorkerInterest(JiajiaWorkerInterest jiajiaWorkerInterest)
    {
        jiajiaWorkerInterest.setUpdateTime(DateUtils.getNowDate());
        return jiajiaWorkerInterestMapper.updateJiajiaWorkerInterest(jiajiaWorkerInterest);
    }

    /**
     * 批量删除社工关注
     * 
     * @param ids 需要删除的社工关注主键
     * @return 结果
     */
    @Override
    public int deleteJiajiaWorkerInterestByIds(String ids)
    {
        return jiajiaWorkerInterestMapper.deleteJiajiaWorkerInterestByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除社工关注信息
     * 
     * @param id 社工关注主键
     * @return 结果
     */
    @Override
    public int deleteJiajiaWorkerInterestById(Long id)
    {
        return jiajiaWorkerInterestMapper.deleteJiajiaWorkerInterestById(id);
    }

    @Override
    public int deleteJiajiaWorkerInterest(JiajiaWorkerInterest JiajiaWorkerInterest) {
        JiajiaWorkerInterest.setUserId(TokenUtil.getUid());
        return jiajiaWorkerInterestMapper.deleteJiajiaWorkerInterest(JiajiaWorkerInterest);
    }
}
